import os


class Config:
    """基础配置，其它配置都继承于此配置"""
    pass


class LocalConfig(Config):
    ERROR_404_HELP = False
    SECURITY_PASSWORD_SALT = 'local_password_salt'
    SECURITY_USER_IDENTITY_ATTRIBUTES = 'email'
    SECRET_KEY = 'local_secret_key'
    MONGODB_SETTINGS = {
        'alias': 'default',
        'db': 'wx1',
        'host': 'localhost',
        'port': 27017,
        'username': 'root',
        'password': '123456'
    }
    MONGO_URI = "mongodb://localhost:27017/wx1"
    RUNNING_ENTERPRISE = "cs_school"
    REDIS_URL = "redis://localhost:6379/7"


class ProdConfig(Config):
    pass


class TestConfig(Config):
    ERROR_404_HELP = False
    SECURITY_PASSWORD_SALT = 'local_password_salt'
    SECURITY_USER_IDENTITY_ATTRIBUTES = 'email'
    SECRET_KEY = 'local_secret_key'
    MONGODB_SETTINGS = {
        'alias': 'default',
        'db': 'wx1',
        'host': 'localhost',
        'port': 27017,
        'username': 'root',
        'password': '123456'
    }
    MONGO_URI = "mongodb://localhost:27017/wx1"
    RUNNING_ENTERPRISE = "cs_school"
    REDIS_URL = "redis://localhost:6379/7"


class AutoTestConfig(TestConfig):
    MONGO_URI = "mongodb://localhost:27017/wx_auto"
    REDIS_URL = "redis://:local@localhost:6379/8"


ENVIRONMENTS = {
    'local': LocalConfig,
    'prod': ProdConfig,
    'test': TestConfig,
    'auto': AutoTestConfig
}

try:
    from local_config import *
except:
    pass

# ENV = 'test'# 'local'# os.environ.get('INVEST_ENV', 'test')
ENV = 'local'
RUN_CONFIG = ENVIRONMENTS[ENV]
